import fetch from 'src/fetch'
import * as userUrl from '../constant/user'

// 登录
export const login = (data) => {
  return fetch({
    url: userUrl.login,
    method: 'post',
    data
  })
}
// 登出
export const logout = () => {
  return fetch({
    url: userUrl.logout,
    method: 'post'
  })
}
// 用户列表
export const getUserList = (data) => {
  return fetch({
    url: userUrl.userList,
    method: 'post',
    data
  })
}
// 获取系统配置
export const getSystems = (params) => {
  return fetch({
    url: userUrl.getSystems,
    params
  })
}
// 设置系统配置
export const setSystems = (data) => {
  return fetch({
    url: userUrl.setSystems,
    method: 'post',
    data
  })
}
// 获取用户信息
export const getUserInfo = (params) => {
  return fetch({
    url: userUrl.getUserInfo,
    params
  })
}
// 赠送积分
export const handselIntegrals = (data) => {
  return fetch({
    url: `/api/integrals/${data.userId}/${data.amount}`,
    method: 'put'
  })
}
// 赠送优惠券
export const handselCoupon = (data) => {
  return fetch({
    url: `/api/coupons/coupon/send`,
    method: 'post',
    data
  })
}
// 重置用户密码
export const resetUserPassword = (userId) => {
  return fetch({
    url: `/api/user/resetUserPassword/${userId}`,
    method: 'put'
  })
}

export const updateAdminPassword = (params) => {
  return fetch({
    url: '/api/companyUser/UpdateAdminPassword',
    params
  })
}

export const deleteUser = (params) => {
  return fetch({
    url:'/api/user/DeleteUserInfo',
    params
  })
}

export const deleteCompanyUserInfo = (params) => {
  return fetch({
    url:'/api/companyUser/DeleteCompanyUserInfo',
    params
  })
}